import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

/**
 * @作者: xiaoxun
 * @日期: 2025/3/10 20:07
 * @描述: 电影实体类
 */

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Movie implements Comparable<Movie>{
	private String name;
	private double score;
	private String actor;

	@Override
	public int compareTo(Movie o) {
		return Double.compare(this.score,o.score);//升序
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;
		Movie movie = (Movie) o;
		return Double.compare(movie.score, score) == 0 && Objects.equals(name, movie.name) && Objects.equals(actor,
				movie.actor);
	}

	@Override
	public int hashCode() {
		return Objects.hash(name, score, actor);
	}
}

